Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login functions device flow proof-of-concept #498

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jgellin-sf
Copy link

What does this PR do?

This PR is a proof-of-concept that adds the sf login functions device command. This command uses the Salesforce device flow to log in to an org, then uses the resulting token as the subject token for the functions API token exchange.

The code borrows heavily from patterns established by existing commands sfdx auth:device:login and sf login functions jwt.

What issues does this PR fix or reference?

W-11635097

@git2gus
Copy link

git2gus bot commented Sep 26, 2022

Git2Gus App is installed but the .git2gus/config.json doesn't exist.

@jgellin-sf jgellin-sf marked this pull request as draft September 26, 2022 21:02
static examples = messages.getMessages('examples');

static flags = {
'instance-url': Flags.string({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering using flags.url as alternative to flags.string

src/commands/login/functions/device.ts Outdated Show resolved Hide resolved
devHub: true,
});
}
await authInfo.save();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save() is also called in the handle function.

@jgellin-sf
Copy link
Author

@peternhale Thanks for the feedback.

For the time being, this PR only exists as a conversation starter for how we can do an interactive functions login in a containerized dev environment.

There are some questions to work out before we think about merging, like:

  • Is this command something we want in this plugin?
  • If so, what should the UX be?
  • And, should it be paired with sf login org device?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants